package cn.wolfcode.luowowo.mgrsite.web.controller;

import cn.wolfcode.luowowo.article.service.IStrategyService;
import cn.wolfcode.luowowo.mgrsite.uitl.UploadUtil;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
public class UploadImgController {

    @Value("${file.path}")
    private String filePath;

    @Reference
    private IStrategyService strategyService;

    @RequestMapping("/uploadImg")
    @ResponseBody  //插件要求这么写的
    public  Object uploadImg(MultipartFile pic){
        String filename = UploadUtil.upload(pic,filePath );
        return filename;
    }


}
